<template>
  <div class="collection">
    <img :src=classList.bannerFileUrl>
    <div class="mianRight">
      <p class="title">{{ classList.courseTitle }}</p>
      <span>累计{{ classList.participationsCount }}人学习</span>
      <p v-if="classList.isFree==='1'" class="free">免费</p>
      <div v-else id="money">
        <span>￥{{ classList.discountPrice }} </span>
        <span>￥{{ classList.coursePrice }}</span> <br>
        <span>{{ classList.discountDesc }}</span>
      </div>
      <button class="collection">
        <i class="el-icon-star-off">收藏</i>
      </button>
      <button class="play" v-if="classList.isFree==='1'">立即观看</button>
      <div v-else>
        <button class="play buy">立即购买</button>
        <button class="play shopCar">加入购物车</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ClassPageMainMain",
  props: {
    classList: [Array, String, Object]
  }
}
</script>

<style scoped lang="less">
div.collection {
  overflow: hidden;
  padding: 20px;
  background-color: white;
  position: relative;
  margin-bottom: 20px;

  img {
    float: left;
    width: 330px;
    height: 220px;
    margin-right: 60px;
  }

  .mianRight {
    float: left;

    p.title {
      font-size: 24px;
    }

    span {
      color: #999999;
      font-size: 14px;
    }

    p.free {
      font-size: 24px;
      color: #00cf8c;
    }

    button.play {
      width: 160px;
      height: 45px;
      border: none;
      outline: none;
      color: white;
      background-color: #00cf8c;
      font-size: 18px;
      border-radius: 4px;
    }

    button.collection {
      width: 120px;
      height: 35px;
      border: 1px solid #999999;
      color: #999;
      font-size: 16px;
      background-color: white;
      outline: none;
      position: absolute;
      right: 30px;
      top: 42px;
    }

    button:hover {
      opacity: 0.8;
    }

    button.buy {
      background-color: #FF8000;
    }

    button.shopCar {
      margin-left: 30px;
    }
  }
}

#money {
  margin: 10px 0;

  span:nth-of-type(1) {
    font-size: 24px;
    color: #000000;
  }

  span:nth-of-type(2) {
    font-size: 14px;
    color: rgb(255, 79, 35);
    text-decoration: line-through;
  }

  span:nth-of-type(3) {
    font-size: 12px;
    color: #fa8c16;
    padding: 2px 6px;
    background-color: #fff7e6;
    border: 1px solid #ffd591;
  }
}
</style>